﻿using System;
using System.Collections.Generic;
using System.ServiceModel.Description;
using System.Text;

namespace Sinacor.Infra.Service.Security.Services 
{
    public sealed class AuditLogAttribute : Attribute, IOperationBehavior
    {
        #region IOperationBehavior Members

        public void AddBindingParameters(OperationDescription operationDescription, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
        {
        }

        public void ApplyClientBehavior(OperationDescription operationDescription, System.ServiceModel.Dispatcher.ClientOperation clientOperation)
        {
        }

        public void ApplyDispatchBehavior(OperationDescription operationDescription, System.ServiceModel.Dispatcher.DispatchOperation dispatchOperation)
        {
            if (dispatchOperation == null)
            {
                throw new ArgumentNullException("dispatchOperation");
            }
            dispatchOperation.Invoker = new ServiceOperationLogInvoker(dispatchOperation.Invoker);
        }

        public void Validate(OperationDescription operationDescription)
        {
        }

        #endregion
    }
}
